<%@ page language="java" import="java.util.*" isELIgnored="false" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head>
<base href="<%=basePath%>">
<meta charset="utf-8" />
<title>无标题文档</title>
<link href="static/css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="static/js/jquery.js"></script>

<style type="text/css">
.input_data {
border: 1px solid #DADADA;
color: #888;
height: 30px;
margin-bottom: 16px;
margin-right: 6px;
margin-top: 2px;
outline: 0 none;
padding: 3px 3px 3px 5px;
width: 70%;
font-size: 12px;
line-height:15px;
box-shadow: inset 0px 1px 4px #ECECEC;
-moz-box-shadow: inset 0px 1px 4px #ECECEC;
-webkit-box-shadow: inset 0px 1px 4px #ECECEC;
}

td{
    word-break:keep-all;
    white-space:nowrap;
    overflow:hidden;/* 内容超出宽度时隐藏超出部分的内容 */
	text-overflow:ellipsis;/* 当对象内文本溢出时显示省略标记(...)*/
}

</style>

<script type="text/javascript">

//扩展jQuery发送非ajax的post请求：使用jQuery 在内存中建立一个form对象，然后调用这个对象的submit方法
$.extend({
    StandardPost:function(url,args){
        var form = $("<form method='post'></form>"),input;
        form.attr({"action":url});
        $.each(args,function(key,value){
            input = $("<input type='hidden'>");
            input.attr({"name":key});
            input.val(value);
            form.append(input);
        });
        form.submit();
    }
});

$(document).ready(function(){
  $(".click").click(function(){
  $(".tip").fadeIn(200);
  });
  
  $(".tiptop a").click(function(){
  $(".tip").fadeOut(200);
});

  $(".sure").click(function(){
  $(".tip").fadeOut(100);
});

  $(".cancel").click(function(){
  $(".tip").fadeOut(100);
});

  
  //$(".tablelink").click(function(){
	 //$(".tip2").fadeIn(200);
  //});
  
  
  
  $(".tiptop a").click(function(){
  $(".tip2").fadeOut(200);
});

  $(".cancel").click(function(){
  $(".tip2").fadeOut(100);
});

 $('.tablelist').find('.delete').click(function() {
    var text = $('.tablelist').find('tr').find('td').eq(1).text();
    $('#detitle').text("请确认是否删除该新闻内容！其标题为："+text);
    var id = $(this).attr("id");
    $('#delete_form').attr("action","newsint/newsInt_delete?id="+id);
    
    $(".tip3").fadeIn(200);
});

  $(".tiptop a").click(function(){
  $(".tip3").fadeOut(200);
});

  $(".cancel").click(function(){
  $(".tip3").fadeOut(100);
});
});

//修改
function update(id,title,source,URL,introduce,creationTime){
	  $('#update_form').attr("action","newsint/newsInt_update?id="+id);
	  $('#title_update').val(title);
	  $('#source_update').val(source);
	  $('#URL_update').val(URL);
	  $('#introduce_update').val(introduce);
	  $('#creationTime_update').val(creationTime);
	  $(".tip2").fadeIn(200);
}

function likeSearch(inputName){
	$('#search_param').attr("name",inputName);
}
</script>


</head>


<body>

	<div class="place">
    <span>位置：</span>
    <ul class="placeul">
    <li><a href="newsint/newsInt_page?page=1&size=10">首页</a></li>
    <li><a href="newsint/newsInt_page?page=1&size=10">新闻管理</a></li>
    </ul>
    </div>
    <div style="text-align: center; margin-top: 8px;">
    <form class="seachform" action="newsint/getLikeProNewsInt" method="post" >
    <label style="font-family: 微软雅黑">综合查询： </label><input placeholder="输入关键词" maxlength="100" id="search_param" name="title" value="${likeParam}" type="text" class="scinput" />
   
    <label>&nbsp;</label><input name="" onclick="likeSearch('title')" type="submit" class="scbtn" value="查询标题"/>
    <label>&nbsp;</label><input name="" onclick="likeSearch('introduce')" type="submit" class="scbtn" value="查询摘要"/>
    <label>&nbsp;</label><input name="" onclick="likeSearch('URL')" type="submit" class="scbtn" value="查询URL"/>
    </form>
    </div>
    <div class="rightinfo">
    
    <div class="tools">
    
    	<ul class="toolbar">
        <li class="click"><span><img src="static/images/t01.png" /></span>添加</li>
        </ul>
    
    </div>
    
    
    <table class="tablelist" style="table-layout:fixed">
    	<thead>
    	<tr>
        <th width="5%">序号</th>
        <th width="30%">标题</th>
        <th width="10%">来源</th>
        <th width="30%">URL</th>
        <th width="10%">添加时间</th>
        <th width="7%">是否审核</th>
        <th width="8%">操作</th>
        </tr>
        <!-- 
        <th width="5%">序号</th>
        <th width="30%">标题</th>
        <th width="10%">来源</th>
        <th width="25%">URL</th>
        <th width="10%">添加时间</th>
        <th width="10%">是否审核</th>
        <th width="10%">操作</th>
         -->
        </thead>
        <tbody>
        
        <c:forEach items="${newsInts.datas}" var="newsInt" varStatus="status">
        <tr>
        <td>${status.count}</td>
        <td id="title" title="${newsInt.title}">${newsInt.title}</td>
        <td>${newsInt.source}</td>
        <td title="${newsInt.URL}">${newsInt.URL}</td>
        <td>${newsInt.creationTime}</td>
        <c:choose>
        <c:when test="${newsInt.state==0}">
        <td style="color:red;text-align: center;">未审核</td>
        </c:when>
        <c:otherwise>
        <td style="color:green;text-align: center;">已审核</td>
        </c:otherwise>
        </c:choose>
        <td style="text-align: center;">
        	<c:if test="${newsInt.state==0}">
        	<a class="tablelink" style="cursor: pointer;" onclick="update('${newsInt.id}','${newsInt.title}','${newsInt.source}','${newsInt.URL}','${newsInt.introduce}','${newsInt.creationTime}')">修改</a>
			</c:if>
			<a style="color:red;cursor: pointer;" id="${newsInt.id}" class="delete"> 删除</a></td>
        </tr> 
        </c:forEach>
               
        </tbody>
    </table>
    
    <div class="pagin">
    	<div class="message">共<i class="blue">${newsInts.total}</i>条记录，当前显示第&nbsp;<i class="blue"><label>${newsInts.pageNo}</label>&nbsp;</i>页</div>
		<ul class="paginList">
			<%@include file="../../static/page/page.jsp" %>
		</ul>
    </div> 
    </div> 
    
   <div class="tip">
        <div class="tiptop">
            <span>添加信息</span><a></a>
        </div>

        <form method="post" action="newsint/newsInt_add" class="basic-grey">
            <h1>
                添加一条新闻信息 <span>可以在这里添加你的新闻信息及URL</span>
            </h1>
            <span id="ce"></span> <label> <span>新闻标题 :</span> <input
                id="cname" placeholder="不超过100个字" maxlength="100" type="text" name="title"/>
            </label> 
            <span id="ce"></span> <label> <span>来源 :</span> <input
                id="cname" type="text" maxlength="100" name="source"/>
            </label> 
            
            <span id="ce"></span> <label> <span>URL（网站地址）:</span> <input
                id="cname" maxlength="150" type="text" name="URL"/>
            </label> 
            <!-- 
            <span id="ce"></span> <label> <span>发布时间:</span> <input
                id="cname" type="date" class="input_data" name="creationTime"/>
            </label> 
             -->
            <span id="ce"></span> <label> <span>新闻简介 :</span> <textarea  name="introduce" placeholder="不超过200个字" maxlength="200" cols="" rows="" ></textarea>
            </label> 
                <div class="tipbtn">
                    <input name="" type="submit" class="sure" value="添加" />&nbsp; <input
                        name="" type="button" class="cancel" value="取消" />
                </div>
            
        </form>
    </div>

    <div class="tip2">
        <div class="tiptop">
            <span>修改信息</span><a></a>
        </div>

        <form method="post" id="update_form" action="" class="basic-grey">
            <h1>
                修改一条新闻信息 <span>可以在这里修改你的新闻信息，但要填写修改理由</span>
            </h1>
            <span id="ce"></span> <label> <span>修改理由 :</span> <input
                id="reason_update" value="" placeholder="不超过100个字" maxlength="100" type="text" name="reason"/>
            </label> 
            <span id="ce"></span> <label> <span>新闻标题 :</span> <input
                id="title_update" value="" maxlength="100" type="text" name="title"/>
            </label> 
            <span id="ce"></span> <label> <span>来源 :</span> <input
                id="source_update" value="" maxlength="100" type="text" name="source"/>
            </label> 
            <span id="ce"></span> <label> <span>URL（网站地址）:</span> <input
                id="URL_update" value="" maxlength="150" type="text" name="URL"/>
            </label> 
             <span id="ce"></span> <label> <span>发布时间:</span> <input
                id="creationTime_update" type="date" class="input_data" name="creationTime"/>
            </label> 
            <span id="ce"></span> <label> <span>新闻简介 :</span><textarea id="introduce_update" value="" maxlength="200" name="introduce" cols="" rows="" ></textarea>
            </label> 
                <div class="tipbtn">
                    <input name="" type="submit" class="sure" value="修改" />&nbsp; <input
                        name="" type="button" class="cancel" value="取消" />
                </div>
        </form>
    </div>

        <div class="tip3">
        <div class="tiptop">
            <span>删除信息</span><a></a>
        </div>

        <form method="post" id="delete_form" action="" class="basic-grey">
            <h1>
                删除一条新闻信息 <span id='detitle'>请确认是否删除这条信息，并填写删除理由</span>
            </h1>
            <span id="ce"></span> <label> <span>删除理由:</span> <input
                id="reason" type="text" placeholder="不超过100个字" maxlength="100" name="reason"/>
            </label> 
                <div class="tipbtn">
                    <input name="" type="submit" class="sure" value="删除" />&nbsp; <input
                        name="" type="button" class="cancel" value="取消" />
                </div>
        </form>
    </div>



    <script type="text/javascript">
	$('.tablelist tbody tr:odd').addClass('odd');
	</script>

</body>

</html>
